package com.bocai.user.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.bocai.user.model.UserInfo;

@Mapper
public interface UserMapper {
	@Select("select * from tbbcuserinfo where iUin = #{mobile}")
	UserInfo selectUserByMobile(@Param("mobile")String mobile) throws Exception;
	
	@Insert("insert into tbbcuserinfo(iUin, szPhone, szPassword) values(#{mobile}, #{mobile}, #{passwd})")
	int insertUserInfo(@Param("mobile")String mobile, @Param("passwd")String passwd) throws Exception;
	
	@Update("update tbbcuserinfo set szBankName = #{bankname}, szBankNum = #{bankno} where iUin = #{mobile}")
	int updateBankInfo(@Param("mobile")String mobile, @Param("bankname")String bankname, @Param("bankno")String bankno) throws Exception;

	@Update("update tbbcuserinfo set szPassword = #{newpassword} where szPassword = #{password} and iUin = #{mobile}")
	int updatePassword(@Param("mobile")String mobile, @Param("bankname")String password, @Param("bankno")String newpassword) throws Exception;

}
